function start_vm (
	[int] $scenario,  #scenario 0..#s-1
	[int] $computer #ordinateur 0..#c-1
) { 
	$VMServer = $CONFIG_SERVERS[$computer]
	$sujet = $sujets[$scenario]
	
	# recherche des vms
	if(($vms_wmi = (get-vmwmi $vmServer $sujet))) {
		foreach($vm_wmi in $vms_wmi) {
			write-host (" STARTING the vm "+($vm_wmi.Path.Server)+"\"+($vm_wmi.ElementName)) -foregroundcolor yellow
			
			# search the matched vm inside our description
			$vm_matched = -1
			$i=0;
			while(($i -lt $sujet.vms.length) -AND ($vm_matched -eq -1)) {
				#write-host ($vm_wmi.ElementName+" =? "+$sujet.scenario_name+"-"+$sujet.vms[$i].name)
				if(($sujet.scenario_name+"-"+$sujet.vms[$i].name) -eq $vm_wmi.ElementName) {
					$vm_matched = $i
				}
				$i++
			}
			
			
			# if the scenario owner does not want a vm to start:
			# specify .start = $FALSE inside the virtual machine description
			if(($vm_matched -eq -1) -OR (!($sujet.vms[$vm_matched].no_start))) {
				if(($vm_wmi.EnabledState -ne [int][VMState]::Running) -AND ($vm_wmi.EnabledState -ne [int][VMState]::Starting)) {
					$vm_wmi | Start-VM -force
				} else {
					write-host "The VM is already started" -foregroundcolor red
				}
			} else {
				write-host "The VM will not be started (as configured in the scenario.ps1 file)" -foregroundcolor magenta
			}
		}
	}
}

$actions.Insert($actions.Count,"start_vm");
set-variable LANG_ACTION__START_VM "DEMARRER les vm" -scope global
